#include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>

using namespace std;

void solution(vector<int> &arr, int num)
{
	int i = 0;
	int l = -1, g = arr.size();
	while (i < g)
	{
		if (arr[i] < num)
		{
			int num = arr[i];
			arr[i] = arr[l + 1];
			arr[l + 1] = num;
			l++;
			i++;
		}
		else if (arr[i] == num)
		{
			i++;
		}
		else 
		{
			int num = arr[i];
			arr[i] = arr[g - 1];
			arr[g - 1] = num;
			g--;
			
		}
	}
}
int main()
{
	vector<int> vec{1, 2, 3,4,4,5,6,5,5,7,3,4,6,89,12,5,12,21};
	solution(vec, 5);
	cout << "经过solution后，序列为: ";
	for (int &i : vec)
	{
		cout << i << " ";
	}
	cout << endl;
	
	return 0;
	
}